<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Broadcast a Condition</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.cond.html">Cond</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="cond.create.html">Cond::create</a></div>
 <div class="up"><a href="class.cond.html">Cond</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="cond.broadcast" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Cond::broadcast</h1>
  <p class="verinfo">(PECL pthreads &gt;= 0.34)</p><p class="refpurpose"><span class="refname">Cond::broadcast</span> &mdash; <span class="dc-title">Broadcast a Condition</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-cond.broadcast-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> 
   <span class="modifier">public</span> 
   <span class="modifier">static</span> 
   <span class="type">boolean</span> 
   <span class="methodname"><strong>Cond::broadcast</strong></span>
    ( <span class="methodparam">
 <span class="type"><span class="type long">long</span></span>
  <code class="parameter">$condition</code>
  </span>
   )</div>

  <p class="para rdfs-comment">Broadcast to all Threads blocking on a call to <span class="function"><a href="cond.wait.html" class="function">Cond::wait()</a></span>.</p>
 </div>


 <div class="refsect1 parameters" id="refsect1-cond.broadcast-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">condition</code></em></dt>

    <dd>

     <p class="para">A handle to a Condition Variable returned by a previous call to <span class="function"><a href="cond.create.html" class="function">Cond::create()</a></span></p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-cond.broadcast-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
 A boolean indication of success.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-cond.broadcast-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3623">
    <p><strong>Example #1 Condition Broadcasting</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/**&nbsp;You&nbsp;cannot&nbsp;use&nbsp;the&nbsp;"new"&nbsp;keyword,&nbsp;a&nbsp;Cond&nbsp;is&nbsp;not&nbsp;a&nbsp;PHP&nbsp;object&nbsp;**/<br /></span><span style="color: #0000BB">$cond&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Cond</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">();<br /></span><span style="color: #FF8000">/**&nbsp;The&nbsp;caller&nbsp;must&nbsp;lock&nbsp;the&nbsp;associated&nbsp;Mutex&nbsp;before&nbsp;a&nbsp;call&nbsp;to&nbsp;broadcast&nbsp;**/<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">Cond</span><span style="color: #007700">::</span><span style="color: #0000BB">broadcast</span><span style="color: #007700">(</span><span style="color: #0000BB">$cond</span><span style="color: #007700">));<br /></span><span style="color: #FF8000">/**&nbsp;Always&nbsp;destroy&nbsp;Cond&nbsp;you&nbsp;have&nbsp;created&nbsp;**/<br /></span><span style="color: #0000BB">Cond</span><span style="color: #007700">::</span><span style="color: #0000BB">destroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$cond</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
bool(true)
</pre></div>
    </div>
   </div>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.cond.html">Cond</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="cond.create.html">Cond::create</a></div>
 <div class="up"><a href="class.cond.html">Cond</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
